// 导入验证规则的包
const joi = require('joi');
const { login } = require('../router/router_handler/user.js');
// 定义验证规则
const username = joi.string().alphanum().min(1).max(10).required();
const password = joi.string().pattern(/^[\S]{6,12}$/).required();
// 定义验证规则 
const id = joi.number().integer().min(1).required();
const nickname = joi.string().required();
const email = joi.string().email().required();
// 定义验证规则 
const avatar = joi.string().required();
// TODO: 定义验证注册|登录表单的对象
exports.reg_login_user = {
    body: {
        username,
        password 
    }
};
// TODO: 验证规则对象|更新用户基本信息
exports.update_userinfo_user = {
    body: {
        id,
        nickname,
        email
    }
};
// TODO: 验证规则对象|重置密码 not唯一性
exports.update_password_user = {
    body: {
        oldPwd: password,
        newPwd: joi.not(joi.ref('oldPwd')).concat(password)
    }
};
// TODO: 验证规则对象|修改头像
exports.update_avatar_user = {
    body: {
        avatar
    }
};
